sync to ps2-less anode
authorElliot Lee <sopwith@src.gnome.org>
Thu, 3 Aug 2000 21:19:04 +0000 (21:19 +0000)
committerElliot Lee <sopwith@src.gnome.org>
Thu, 3 Aug 2000 21:19:04 +0000 (21:19 +0000)
sync to ps2-less anode

gdk/linux-fb/gdkinput-ps2.c

index c9649f4fb52e8fd189a0c2bdc7ec05e39d324be4..49130f20aec23f0f5ea8e98b112be54d7bea398a 100644 (file)
@@ -651,12 +651,19 @@ mouse_open(void)
   buf[i++] = 232; /* device resolution */
   buf[i++] = 1;
   write(retval->fd, buf, i);
-  read(retval->fd, buf, 3); /* Get rid of misc garbage whatever stuff from mouse */
-
-  fcntl(retval->fd, F_SETFL, O_RDWR|O_NONBLOCK);
+  if(read(retval->fd, buf, 3) < 0
+     || getenv("GDK_NO_PS2MOUSE")) /* Get rid of misc garbage whatever stuff from mouse */
+    {
+      close(retval->fd);
+      retval->fd = -1;
+    }
+  else
+    {
+      fcntl(retval->fd, F_SETFL, O_RDWR|O_NONBLOCK);
 
-  gioc = g_io_channel_unix_new(retval->fd);
-  retval->fd_tag = g_io_add_watch(gioc, G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL, handle_input, retval);
+      gioc = g_io_channel_unix_new(retval->fd);
+      retval->fd_tag = g_io_add_watch(gioc, G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL, handle_input, retval);
+    }
 
   retval->x = gdk_display->modeinfo.xres >> 1;
   retval->y = gdk_display->modeinfo.yres >> 1;